class CreateMagazines < ActiveRecord::Migration
  def self.up
    create_table :magazines do |t|
      t.column :name, :string, :limit => 45, :null => false
      t.column :description, :text
      t.column :publisher, :string, :limit => 45
      t.column :category_id, :integer
    end
    
    execute "alter table magazines add constraint fk_magazines_categories
              foreign key (category_id) references categories(id)"
  end

  def self.down
    drop_table :magazines
  end
end
